<div class="container">
    <h4 onclick="image.addImage(1, '<?= application\entity\enu\ImageType::IMAGE ?>')" >Quản trị hình ảnh upload</h4>
</div>
<div class="container" style="margin-bottom: -1px;" >
    <div style="margin-top: 10px" >
        <ul class="nav nav-tabs nav-collapse">
            <li class="active" >
                <a href="<?= $this->baseUrl ?>cp/image.html">Danh sách hình ảnh</a>
            </li>
        </ul>
    </div>      
</div>    
<div class="container" style="border: 1px solid #ccc;" >
    <form id="addImage" class="form-vertical" style="margin-top: 20px;" >
        <div class="col-md-2">
            <div class="form-group ">
                <input class="form-control" name="url" placeholder="Nhập địa chỉ ảnh" />
            </div>
        </div>
        <div class="col-md-2">
            <div class="form-group ">
                <div id="upload1" class="input-group">
                    <input type="file" style="display:none" id="lefile" name="imageFile">
                    <input type="text" class="form-control" id="photoCover">
                    <a onclick="$('#lefile').click();" class="btn btn-default input-group-addon">Chọn</a>                     
                </div>
            </div>
        </div>
        <div class="col-md-2">
            <div class="form-group ">
                <input class="form-control" name="target" placeholder="Nhập target" />
            </div>
        </div>
        <div class="col-md-2">
            <div class="form-group ">
                <select class="form-control" name="type">
                    <option value="<?= application\entity\enu\ImageType::_DEFAULT ?>">Loại ảnh mặc định</option>
                    <option value="<?= application\entity\enu\ImageType::IMAGE ?>">Hình ảnh</option>
                    <option value="<?= application\entity\enu\ImageType::USER ?>">Người dùng</option>
                </select>
            </div>
        </div>
        <div class="col-md-3">
            <div class="form-group ">
                <button type="button" class="btn btn-info" onclick="image.add();" >
                    <i class="glyphicon glyphicon-search"></i> Thêm ảnh
                </button>                
            </div>
        </div>
    </form>
    <p class="clearfix" ></p>
    <div style="margin-top: 10px;">
        <h5 class="pull-left alert alert-success" style="padding: 10px; width: 33%;" >
            Tìm thấy tổng số 
            <span style="color: tomato; font-weight: bolder"><?= $dataPage->dataCount ?></span> 
            hình ảnh trong
            <span style="color: tomato; font-weight: bolder"><?= $dataPage->pageCount ?></span> trang.
        </h5>
        <div class="btn-toolbar pull-right" style="padding: 15px 0px;">
            <?= $this->loadView('/widget/page'); ?>
        </div>
    </div>
    <p class="clearfix" ></p>
    <table  class="table table-striped table-bordered table-responsive" style="margin-bottom: 10px;" >
        <thead>
            <tr class="success" >
                <th class="text-center" style="vertical-align: middle; width: 120px;" >Hình ảnh</th>
                <th class="text-center" style="vertical-align: middle" >Thông tin</th>
                <th class="text-center" style="vertical-align: middle;" >Module</th>                             
                <th class="text-center" style="vertical-align: middle;" >Target</th>                             
            </tr>
        </thead>
        <tbody>
            <?php if ($dataPage->dataCount == 0) { ?>
                <tr>
                    <td class="text-center text-danger" style="vertical-align: middle" colspan="4" >
                        Không tìm thấy hình ảnh nào
                    </td>
                </tr>
            <?php } ?>
            <?php foreach ($dataPage->data as $item) { ?>
                <tr>
                    <td class="text-center" style="vertical-align: middle" >
                        <img src="<?= $this->baseUrl ?><?= @$item->id ?>" class="thumbnail" style="width: 100px;" />
                    </td>
                    <td class="text-center" style="vertical-align: middle" ><?= @$item->imageType ?></td>
                    <td class="text-center" style="vertical-align: middle" ><?= @$item->type ?></td>
                    <td class="text-center" style="vertical-align: middle" ><?= @$item->target ?></td>
                </tr>
            <?php } ?>
        </tbody>
    </table>
    <div class="btn-toolbar pull-right" style="padding: 15px 0px;">
        <?= $this->loadView('/widget/page'); ?>
    </div>
    <p class="clearfix" ></p>
</div>